function doRedirectWork(vehicleDD, manufacturerDD, modelDD, languageName) 
{
    var d = document;
    var vehicleId = d.getElementById(vehicleDD).value;
    var manufacturerId = d.getElementById(manufacturerDD).value;
    var modelId = d.getElementById(modelDD).value;
    if (vehicleId && manufacturerId && modelId) {
        switch (vehicleId) {
            case '1':
                window.location = "http://wixeurope.com/" + getTranslation("mainSearchFiltronOther", languageName) + "?vehicleId=" + vehicleId + "&manufacturerId=" + manufacturerId + "&modelId=" + modelId + "&languageName=" + languageName;
                break;
            case '2':
                window.location = "http://wixeurope.com/" + getTranslation("mainSearchFiltronPassenger", languageName) + "?vehicleId=" + vehicleId + "&manufacturerId=" + manufacturerId + "&modelId=" + modelId + "&languageName=" + languageName;
                break;
            case '3':
                window.location = "http://wixeurope.com/" + getTranslation("mainSearchFiltronTruck", languageName) + "?vehicleId=" + vehicleId + "&manufacturerId=" + manufacturerId + "&modelId=" + modelId + "&languageName=" + languageName;
                break;
			case '6,w':
			    window.location = "http://wixeurope.com/" + getTranslation("mainSearchFiltronMachines", languageName) + "?vehicleId=" + vehicleId + "&manufacturerId=" + manufacturerId + "&modelId=" + modelId + "&languageName=" + languageName;
                break;
			case '9,w':
			    window.location = "http://wixeurope.com/" + getTranslation("mainSearchFiltronMotorcycle", languageName) + "?vehicleId=" + vehicleId + "&manufacturerId=" + manufacturerId + "&modelId=" + modelId + "&languageName=" + languageName;
                break;
			case '10,w':
			    window.location = "http://wixeurope.com/" + getTranslation("mainSearchFiltronQuad", languageName) + "?vehicleId=" + vehicleId + "&manufacturerId=" + manufacturerId + "&modelId=" + modelId + "&languageName=" + languageName;
                break;
            default:
                return false;
        }
    }
}

function doBrandWorkFiltron(masterComboId, detailComboId, languageName) {

    httpObject = getHTTPObject();
    if (httpObject != null) {
        var parentCombo = document.getElementById(masterComboId);
        if (parentCombo) {
            if (detailComboId) {
                var url = "../../../Ajax/BrandMasterDetailAjaxFiltron.aspx?masterItemId=" + parentCombo.value + "&languageName=" + languageName;
                httpObject.open("GET", url, true);
                httpObject.onreadystatechange = function() {
                    if (httpObject.readyState == 4) {
                        var combo = document.getElementById(detailComboId);
                        if (combo != null) {
                            combo.options.length = 0;
                            var response = httpObject.responseText;
							response = response.replace('&#203;', 'Ë');
							response = response.replace('&#321;', 'Ł');
                            var items = response.split(";");
                            var count = items.length;
                            for (var i = 0; i < count; i++) {
                                var options = items[i].split(",");
                                if (options[0] != "")
									//options[0] = options[0].replace('&#203;', 'Ë');
                                    combo.options[i] = new Option(options[0], options[1]);
                            } //for
                            showHideBrandCombo(detailComboId);
                        } //if
                    } //if state
                } //func
                httpObject.send(null);
            } //if
        } //if
    } //if
}

function doTypeWorkFiltron(masterComboId, detailComboId, languageName) {

    httpObject = getHTTPObject();
    if (httpObject != null) {
        var parentCombo = document.getElementById(masterComboId);
        var vehicleId = document.getElementById('id_master');
        if (vehicleId.value.length > 2) {
            if (parentCombo) {
                if (detailComboId) {
                    var url = "../../../Ajax/ModelMasterDetailAjax.aspx?masterItemId=" + parentCombo.value + "&languageName=" + languageName;
                    httpObject.open("GET", url, true);
                    httpObject.onreadystatechange = function() {
                        if (httpObject.readyState == 4) {
                            var combo = document.getElementById(detailComboId);
                            if (combo != null) {
                                combo.options.length = 0;
                                var response = httpObject.responseText;
                                var items = response.split(";");
                                var count = items.length;
                                for (var i = 0; i < count; i++) {
                                    var options = items[i].split("|");
                                    if (options[0] != "")
                                        combo.options[i] = new Option(options[0], options[1]);
                                } //for
                                showHideBrandCombo(detailComboId);
                            } //if
                        } //if state
                    } //func
                    httpObject.send(null);
                } //if
            } //if
        } else {
            if (parentCombo) {
                if (detailComboId) {
                    var url = "../../../Ajax/ModelMasterDetailAjaxFiltron.aspx?masterItemId=" + parentCombo.value + "&languageName=" + languageName;
                    httpObject.open("GET", url, true);
                    httpObject.onreadystatechange = function() {
                        if (httpObject.readyState == 4) {
                            var combo = document.getElementById(detailComboId);
                            if (combo != null) {
                                combo.options.length = 0;
                                var response = httpObject.responseText;
                                var items = response.split(";");
                                var count = items.length;
                                for (var i = 0; i < count; i++) {
                                    var options = items[i].split("|");
                                    if (options[0] != "")
                                        combo.options[i] = new Option(options[0], options[1]);
                                } //for
                                showHideBrandCombo(detailComboId);
                            } //if
                        } //if state
                    } //func
                    httpObject.send(null);
                } //if
            } //if
        } // if length
        
    } //if
}

function clearBrandCombo(comboId) {
    if (comboId) {
        var comboToClear = document.getElementById(comboId);
        if (comboToClear) {
            comboToClear.options.length = 0;
            comboToClear.options[0] = new Option("---", -1);
        } //if
    } //if
}

function showHideBrandCombo(comboId) {
    if (comboId) {
        var item = document.getElementById('div' + comboId);
        if (item) {
            var comboToShowHide = document.getElementById(comboId);
            if (comboToShowHide) {
                if (comboToShowHide.options) {
                    if (comboToShowHide.options.length <= 1) {
                        item.style.display = 'none';
                    } else {	//if
                        item.style.display = 'block';
                    } //else
                } //if
            } //if
        } //if
    } //if
}

function doActiveSubmit(languageName) {
	var vehdd = jQuery("#id_master");
	var branddd = jQuery("#id_BrandDetail");
	var typedd = jQuery("#id_TypeDetail");
	var submitdd = jQuery("#ddsubmitFiltron");
	if ((vehdd.val != -1) && (branddd.val != -1) && (typedd.val != -1)) {
		submitdd.attr("href", "javascript:doRedirectWork('id_master', 'id_BrandDetail', 'id_TypeDetail', '"+languageName+"')");
		//submitdd.css("background", "#1b1818");
		submitdd.css("cursor", "pointer");
	}
	if ((vehdd.val == -1) || (branddd.val == -1) || (typedd.val == -1)) {
		submitdd.attr("href", "javascript: return false;");
		//submitdd.css("background", "#1b1818");
		submitdd.css("cursor", "default");
	}
}

